Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear cache on reload #11673

Merged
merged 68 commits into from
Dec 10, 2024
Merged

Clear cache on reload #11673

merged 68 commits into from
Dec 10, 2024

Conversation

GregoryTravis
Copy link
Contributor

@GregoryTravis GregoryTravis commented Nov 26, 2024

This uses #11577. It creates a Managed_Resource containing a reference that is cleared on reload; this change detects this, and clears the cache.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@JaroslavTulach JaroslavTulach force-pushed the wip/gmt/11485-clear-cache branch from 5b563d4 to c493ec0 Compare November 27, 2024 16:32
@JaroslavTulach JaroslavTulach force-pushed the wip/gmt/11485-clear-cache branch from 1fb2517 to ef15d90 Compare November 27, 2024 16:34
get self = self.mr.with .get

clear self =
self.mr.with (ref-> ref.put Nothing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the most recent changes in the implementation this code shouldn't set the ref to Nothing, but to a DataflowError - however I admit, I have no way to do it! I don't seem to be able to send Error into ref.put and I even managed to crash the engine while doing that #11774

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using a special value for the test-only implementation.

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you need to (also) check for isException(). Otherwise OK from my perspective.


get self = self.mr.with .get

clear self =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • if Promote broken values instead of ignoring them #11777 gets implemented
  • then the clear method would change its behavior
  • if the ref in ret.put Nothing would be a DataflowError then
  • the result of whole self.m.with would be a DataflowError
  • and the method would terminate immediately returning the DataflowError

@jdunkerley jdunkerley added this to the 2024-End-Of-Year milestone Dec 10, 2024
Comment on lines 532 to 535
HTTP.fetch base_url_with_slash+'test_download?length=13'
get_num_response_cache_entries . should_equal 1
HTTP.fetch base_url_with_slash+'test_download?length=14'
HTTP.fetch base_url_with_slash+'test_download?length=15'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
HTTP.fetch base_url_with_slash+'test_download?length=13'
get_num_response_cache_entries . should_equal 1
HTTP.fetch base_url_with_slash+'test_download?length=14'
HTTP.fetch base_url_with_slash+'test_download?length=15'
HTTP.fetch base_url_with_slash+'test_download?length=10'
get_num_response_cache_entries . should_equal 1
HTTP.fetch base_url_with_slash+'test_download?length=14'
HTTP.fetch base_url_with_slash+'test_download?length=15'

What if we fetch a thing that was cached before? IMO this could be useful to test. But not strictly necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks good. @GregoryTravis have you tested the latest build in practice?

e.g. using this scenario?

@GregoryTravis
Copy link
Contributor Author

I think it looks good. @GregoryTravis have you tested the latest build in practice?

e.g. using this scenario?

Yes, just tested it.

@GregoryTravis GregoryTravis added the CI: Ready to merge This PR is eligible for automatic merge label Dec 10, 2024
@mergify mergify bot merged commit 9e00b9d into develop Dec 10, 2024
41 of 42 checks passed
@mergify mergify bot deleted the wip/gmt/11485-clear-cache branch December 10, 2024 18:51
jdunkerley pushed a commit that referenced this pull request Dec 13, 2024
(cherry picked from commit 9e00b9d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants